.chat-bubble {
  max-width: 80%;
  margin-bottom: 16px;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  min-width: 0; /* Allow flex item to shrink */
}

.chat-bubble.user {
  align-self: flex-end;
  background-color: #007acc;
  color: white;
  margin-left: auto;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background-color: #f8f9fa;
  color: #333;
  border: 1px solid #e9ecef;
}

.chat-bubble.error {
  align-self: flex-start;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  opacity: 0.8;
}

.sender {
  font-weight: 600;
  margin-right: 8px;
}

.timestamp {
  font-size: 11px;
}

.streaming-indicator {
  color: #28a745;
  animation: pulse 1.5s infinite;
  margin-left: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bubble-content {
  line-height: 1.5;
}

.content-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow: hidden;
}

.content-line {
  margin: 0;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bubble-content p {
  margin: 0 0 8px 0;
}

.bubble-content p:last-child {
  margin-bottom: 0;
}

.bubble-content ol,
.bubble-content ul {
  margin: 8px 0;
  padding-left: 20px; /* Reduced since we're using inside positioning */
  margin-left: 0; /* Reset any inherited margin */
  list-style-position: inside; /* Position numbers inside the content area */
}

.bubble-content li {
  margin: 4px 0;
  padding-left: 0; /* Reset any inherited padding */
}

.bubble-content code {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.chat-bubble.user .bubble-content code {
  background-color: rgba(255, 255, 255, 0.2);
}

.bubble-content pre {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 8px 0;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-bubble.user .bubble-content pre {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.error-content {
  font-family: monospace;
  white-space: pre-wrap;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 200px;
}

.image-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e9ecef;
}

.image-name {
  font-size: 11px;
  margin-top: 4px;
  text-align: center;
  opacity: 0.8;
  word-break: break-all;
}

/* Syntax highlighting adjustments */
.chat-bubble pre[class*="language-"] {
  margin: 8px 0;
  border-radius: 6px;
}

.chat-bubble code[class*="language-"] {
  font-size: 13px;
}

/* Markdown content styles */
.markdown-content {
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.markdown-content p {
  margin: 0 0 8px 0;
}

.markdown-content p:last-child {
  margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child,
.markdown-content h4:first-child,
.markdown-content h5:first-child,
.markdown-content h6:first-child {
  margin-top: 0;
}

.markdown-content blockquote {
  border-left: 4px solid #ddd;
  padding-left: 16px;
  margin: 8px 0;
  color: #666;
}

.chat-bubble.user .markdown-content blockquote {
  border-left-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.9);
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #ddd;
  padding: 6px 12px;
  text-align: left;
}

.markdown-content th {
  background-color: #f8f9fa;
  font-weight: 600;
}

.chat-bubble.user .markdown-content th {
  background-color: rgba(255, 255, 255, 0.1);
}

.chat-bubble.user .markdown-content th,
.chat-bubble.user .markdown-content td {
  border-color: rgba(255, 255, 255, 0.3);
}

/* KaTeX math styling */
.katex {
  font-size: 1em !important;
}

.katex-display {
  margin: 12px 0 !important;
  text-align: center;
}

/* Underline support */
.markdown-content u {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  .chat-bubble {
    max-width: 95%;
  }
  
  .image-preview {
    max-width: 150px;
  }
  
  .image-preview img {
    max-height: 100px;
  }
} 